﻿

namespace LxCFD
{
    public class TransientTimeFixed : TransientTimeBase
    {
        public double FixInterval = 1;
        public override void Initialize()
        {
            setTime();
            dt = FixInterval;
            dto = FixInterval;
            dtoo = FixInterval;
            SetTransientFactor();
        }

        private void setTime()
        {
            int timeStepsCount = AppRes.StepsCenter.TransientStep.StepsCount;
            if (IsImplicit)
            {
                EquationTime = FixInterval * (timeStepsCount + 1);
            }
            else
            {
                EquationTime = FixInterval * timeStepsCount;
            }
            ResultTime = FixInterval * timeStepsCount;
        }
        public override void MoveNextTimeStep()
        {
            setTime();
        }

        public override TransientTimeBase GetCopy()
        {
            return new TransientTimeFixed() { IsImplicit = IsImplicit, IsSecondOrder = IsSecondOrder, FixInterval = FixInterval };
        }
    }

}
//public override TransientTimeBase GetCopy()
//{
//    TransientTimeFixed transientTimeFixed = new TransientTimeFixed();
//    transientTimeFixed.fixInterval = fixInterval;
//    return transientTimeFixed;
//}
//public override void Reset(ResetTypes clearType)
//{
//    base.Reset(clearType);
//    switch (clearType)
//    {
//        case ResetTypes.清除以加载新文件:
//        case ResetTypes.清除以加载新网格:
//        case ResetTypes.清空数据强制初始化:
//        case ResetTypes.参数变更更新求解模块:
//            setTime();
//            dt = fixInterval;
//            dto = fixInterval;
//            dtoo = fixInterval;
//            break;
//        case ResetTypes.不清空:
//        default:
//            break;
//    }
//}
//if (isImplicit)
//{
//    equationTime = resultTime = fixInterval * timeStepsCount;
//}
//else
//{
//    equationTime = fixInterval * (timeStepsCount - 1);
//    resultTime = fixInterval * timeStepsCount;
//}